﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models {
    import flash.net.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.utils.*;

    public class ProtocolModel extends Actor {

        private var _protocol:Object;

        private static const FILES:String = "files";
        private static const REQUESTS:String = "requests";

        public function ProtocolModel(){
            this._protocol = {};
            super();
        }
        public function set protocol(_arg1:Object):void{
            this._protocol = _arg1;
        }
        public function getFile(_arg1:String, _arg2:Object):String{
            return (this.getPath(FILES, _arg1, _arg2));
        }
        public function getRequest(_arg1:String, _arg2:Object):String{
            return (this.getPath(REQUESTS, _arg1, _arg2));
        }
        public function getMethod(_arg1:String):String{
            var _local2:Object = this.getData(REQUESTS, _arg1);
            return ((((_local2) && (_local2["method"]))) ? _local2["method"] : URLRequestMethod.GET);
        }
        public function needsSession(_arg1:String):Boolean{
            var _local2:Object = this.getData(REQUESTS, _arg1);
            return (((_local2) && (!(_local2["no_session"]))));
        }
        private function getPath(_arg1:String, _arg2:String, _arg3:Object):String{
            var _local4:Object = this.getData(_arg1, _arg2);
            return ((_local4) ? Strings.replacePatterns(_local4.path, _arg3) : _arg2);
        }
        public function hasFile(_arg1:String):Boolean{
            return (this.hasData(FILES, _arg1));
        }
        public function hasRequest(_arg1:String):Boolean{
            return (this.hasData(REQUESTS, _arg1));
        }
        private function hasData(_arg1:String, _arg2:String):Boolean{
            return (!((this.getData(_arg1, _arg2) == null)));
        }
        private function getData(_arg1:String, _arg2:String):Object{
            return (((this._protocol[_arg1]) && (this._protocol[_arg1][_arg2])));
        }

    }
}//package net.wooga.pets.models 
